package com.mstar.qs.common.jdbc;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.ResultSetHandler;
import org.apache.commons.dbutils.handlers.BeanListHandler;

public class DbUtils {
	public static <T> List<T> query(Class<T> c, String sql, Connection conn) throws SQLException{
		ResultSetHandler<List<T>> h=new BeanListHandler<T>(c);
		QueryRunner run = new QueryRunner();
		return run.query(conn, sql,h);
	}

}
